package com.du.web.sample.util.state;


import com.du.web.sample.util.state.contract.ContractFlow;
import com.du.web.sample.util.state.contract.ContractState;
import com.du.web.sample.util.state.leave.LeaveFlow;
import com.du.web.sample.util.state.leave.LeaveState;

/**
 * @desc:
 * @author: shuangdu
 * @date: 2022/11/30
 * @since: 1.8
 */
public class FlowManager {

    public static void main(String[] args) {
        AbstractFlow flow = new LeaveFlow();
        State next = flow.next(LeaveState.BEGIN, Action.REJECT, null);
        System.out.println(next);
        State next1 = flow.next(next, Action.PASS, null);
        System.out.println(next1);
        State next2 = flow.next(next1, Action.PASS, null);
        System.out.println(next2);
        State next3 = flow.next(next2, Action.PASS, null);
        System.out.println(next3);
        State next5 = flow.next(next3, Action.PASS, null);
        System.out.println(next5);

        ContractFlow flow1 = new ContractFlow();
        State cNext = flow1.next(ContractState.BEGIN, Action.SUBMIT, null);
        System.out.println(cNext);

    }
}
